import { MongoClient } from "mongodb";
import { URL, DB_NAME } from "./config";

/**
 * 异步连接数据库
 * @returns 数据库handle
 */
export async function initDB() {
	const client: MongoClient = new MongoClient(URL);
	await client.connect();
	const db = client.db(DB_NAME);
	return db;
}
